package com.freemodbus4j.core.utils;

/**
 * following class implements longitudinal redundancy checkFrame.
 */
public class LRC {
    static public int calc(byte[] b) {
        int lrc = 0;

        for (byte aB : b) {
            lrc += aB;
        }
        return (byte) (-lrc) & 0xff;
    }
}
